<?php

namespace Sharks\Core\Http\View;

use Sharks\Core\Http\Response;

/**
 * json 视图
 */
class JsonView extends View {
    private $with;

    public function __construct(array $with) {
        $this->with = $with;
    }

    public function render(Response $response) {
        $response->setContentType('application/json');
        echo json_encode($this->with);
    }
}